import Foundation

enum NSBundleInfoKey: String {
    case name = "CFBundleName" // appName
    case version = "CFBundleShortVersionString" // appVersion
    case developVersion = "CFBundleVersion" // developVersion
}

extension NSBundle {
    
    /** info.plist 内容 */
    static var mainInfoDictionary: NSDictionary {
        get { return NSBundle.mainBundle().infoDictionary! }
    }
    
    /** app名字 */
    static var appName: String {
        get { return mainInfoDictionary.valueForKey(NSBundleInfoKey.name.rawValue, notKeyDefaultValue: "")}
    }
    
    /** app版本 */
    static var appVersion: String {
        get { return mainInfoDictionary.valueForKey(NSBundleInfoKey.version.rawValue, notKeyDefaultValue: "")}
    }
    
    /** app开发版本 */
    static var developVersion: String {
        get { return mainInfoDictionary.valueForKey(NSBundleInfoKey.developVersion.rawValue, notKeyDefaultValue: "")}
    }
}
